/*
New Scotland Yard is an online multiplayer adaptation
of the boardgame "Scotland Yard". Copyright (C) 2011
Massey University Software C Group 3
This program is free software: you can redistribute it
and/or modify it under the terms of the GNU General
Public License as published by the Free Software
Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General
Public License along with this program. If not, see
<http://www.gnu.org/licenses/>.
*/
package nz.ac.massey.softwarec.group3.reverseAJAX;
import javax.servlet.http.HttpSession;
import nz.ac.massey.softwarec.group3.game.Game;
import org.directwebremoting.ScriptSession;
import org.directwebremoting.WebContextFactory;
/**
* ScriptSessionManager - Class which manages all the ReverseAJAX ScriptSessions.
* @version 1.0 Release
* @since 1.0
* @authors Natalie Eustace | Wanting Huang | Paul Smith | Craig Spence
*/
public class ScriptSessionManager implements ScriptSessionManagerInterface {
/**
* Sets the script session for the game.
*/
@Override
public void setScriptSessionGame() {
final ScriptSession scriptSession = WebContextFactory.get().getScriptSession();
final HttpSession session = WebContextFactory.get().getSession();
final Game game = (Game) session.getAttribute("game");
final String email = (String) session.getAttribute("email");
scriptSession.setAttribute("game", game);
scriptSession.setAttribute("email", email);
}
}